<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
    <title>场馆管理</title>
    <link rel="stylesheet" type="text/css" href="Assets/css/reset.css"/>
    <script type="text/javascript" src="Assets/js/jquery-1.8.3.min.js"></script>
    <link rel="stylesheet" type="text/css" href="Assets/plugins/FlexSlider/flexslider.css">
    <script type="text/javascript" src="Assets/plugins/FlexSlider/jquery.flexslider.js"></script>
    <script type="text/javascript" src="Assets/js/main.js"></script>
    <link rel="stylesheet" type="text/css" href="Assets/css/thems.css">
    <link rel="stylesheet" type="text/css" href="Assets/css/responsive.css">

    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>

    <script language="javascript">

    </script>
</head>

<body>
<!--头部-->
<div class="head clearfix">
    <div class="logo"><a href=""><img src="Assets/images/logo.jpg" alt="信本财富"/></a></div>
    <div class="head_r">
        <div class="lang">
            <a href="">中文</a>|
            <a href="">English</a>
        </div>
        <ul class="nav clearfix">
            <li class="now"><a href="index.html">首页</a></li>
            <li><a href="product.html">课程管理</a></li>
            <li><a href="vip.html">会员管理</a></li>
            <li><a href="sig_in.html">签到管理</a></li>
            <li><a href="custom-made.html">定制会员卡</a></li>
            <li><a href="subbranch.html">场馆管理</a></li>
            <li><a href="staff.html">员工管理</a></li>
        </ul>
        <div class="nav_m">
            <span class="n_icon">&nbsp;</span>
            <ul>
                <li><a href="index.html">首页</a></li>
                <li><a href="about.html">关于信本</a></li>
                <li class="now"><a href="news.html">信本动态</a></li>
                <li><a href="product.html">信本业务</a></li>
                <li><a href="#">信本学院</a></li>
                <li><a href="#">社会责任</a></li>
                <li><a href="#">联系我们</a></li>
            </ul>
        </div>
    </div>
</div>
<!--头部-->
<!--幻灯片-->
<div class="banner">
    <div class="slider">
        <div class="flexslider">
            <ul class="slides">
                <li>
                    <a href=""><img src="Assets/upload/banner.jpg" alt="" /></a>
                </li>
                <li>
                    <a href=""><img src="Assets/upload/banner_a.jpg" alt="" /></a>
                </li>
                <li>
                    <a href=""><img src="Assets/upload/banner_b.jpg" alt="" /></a>
                </li>
                <li>
                    <a href=""><img src="Assets/upload/banner_c.jpg" alt="" /></a>
                </li>
                <li>
                    <a href=""><img src="Assets/upload/banner_d.jpg" alt="" /></a>
                </li>
            </ul>
        </div>
    </div>
</div>
<!--幻灯片-->
<div class="scd clearfix">
    <div class="scd_l">
        <div class="title"><span>场馆管理</span></div>
        <ul class="s_nav">
            <li class="now"><a href="subbranch.html"><em>返回</em></a></li>
            <li class="now" onclick="classShow()"><em>添加教室</em></li>
            <li id="class1s">名&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称:<input id="class1a" type="text"></li>
            <li id="class2s">容纳人数:<input id="class2a" type="text">人</li>
            <li id="class3s"><button id="class3a" type="submit" class="btn btn-default">确认</button></li>
        </ul>

    </div>
    <div class="scd_r">
        <div class="s_title">

            <div class="pst">
                当前位置：
                <a href="">首页</a>>
                <a href="">场馆管理</a>>

            </div>
        </div>
        <div class="scd_m">
            <div class="news" id="tbodyul">

            </div>
            <div class="news" id="tbodyu2">
       <ul id="tbodyul1">

       </ul>
            </div>
        </div>
    </div>
</div>

</body>
</html>
<script>

    var id;
    var path = "/" + location.pathname.split("/")[1];
    $(function () {

        $("#class1s").hide();
        $("#class2s").hide();
        $("#class3s").hide();

        var thisURL = document.URL;
        var getval = null;
        //判断是不是带有id的请求
        if (thisURL.search("id=") != -1) {
            getval = thisURL.split('?')[1];
            id = getval.split("=")[1];
        }

        console.log(id+"========================")

        //查询教室
        $.get(path+"/queryClassroom2",{"id":id},function (list3) {
            $.each(list3,function (i3,li3) {
                $("#tbodyul1").append(
                '<li>教室名称：'+li3[1] +'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;教室容纳人数'+ li3[2]+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button id="" type="submit" class="btn btn-default" onclick="deleteClass('+li3[0]+')">删除</button></li>'
            );

            });


        },"json");


        $.get(path+"/shopQuery2",{"id":id},function (list2) {

            console.log(list2+"=================")

            $.each(list2,function (i2,li2) {
                console.log(li2.coursesname+"================")

                var path = "/" + location.pathname.split("/")[1];

                $("#tbodyul").append(

                    '<dl class="clearfix">'+
                    '<dt><a href=""><img src='+path+'/'+li2.shopimg+' alt=""/></a></dt>'+
                    '<dd>'+
                    '<div class="title"><a href="">'+li2.shopname+'</a></div>'+
                    '<div class="des">联系人:'+li2.shopcontacts+'</div>'+
                    '<div class="des">电话:'+li2.shopphone+'</div>'+
                    '<div class="des">类型:'+li2.shoptype+'</div>'+
                    '<div class="des">地区:'+li2.shoppro+li2.shopcity+li2.shoparea+'</div>'+
                    '<div class="des">详细地址:'+li2.shopsite+'</div>'+

                    '<button type="submit" class="btn btn-default" onclick="delete1()">删除</button>'+
                    '</dd>'+
                    '</dl>'
                );
            });

        },"json");





    });
    function delete1(){

        $.get(path+"/shopdelete",{"id":id},function (list) {
            var li= eval(list);
            console.log(li+"===============");
            if (li){

                window.location.href="subbranch.html"

            } else {
                alert("删除失败")

            }

        },"json");

    }
    //删除教室
    function deleteClass(classid){
console.log(classid+"=============")
        $.get(path+"/TClassroomDelete",{"classid":classid},function (list) {
            var li= eval(list);
            console.log(li+"===============");
            if (li){

                window.location.href="subbranchQuery.html?id="+id;

            } else {
                alert("删除失败")

            }

        },"json");

    }
    
    function classShow() {
        $("#class1s").show();
        $("#class2s").show();
        $("#class3s").show();
    }
    $("#class3a").click(function () {
        var classname = $("#class1a").val();
        var classnumber =$("#class2a").val();

        console.log(classnumber);
        var path = "/" + location.pathname.split("/")[1];
        $.get(path+"/ClassroomAdd",{"classroomName":classname,"classroomCapacity":classnumber,"shopid":id},function (list) {
            var li= eval(list);
            console.log(li+"===============");
            if (li){

                window.location.href="subbranchQuery.html?id="+id;
            } else {
                alert("添加失败")

            }

        },"json");



    });

</script>
